home *** CD-ROM | disk | FTP | other *** search
/ Action Games (2008) / akcnihry1.iso / AT-Robots 2.10 / EGAVGA.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-04-27  |  2.9 KB  |  86 lines

  1. { Portions Copyright (c) 1985, 1990 by Borland International, Inc. }
  2. (*
  3. Copyright (c) 1999, Ed T. Toton III. All rights reserved.
  4.  
  5. Redistribution and use in source and binary forms, with or without
  6. modification, are permitted provided that the following conditions
  7. are met:
  8.  
  9.    Redistributions of source code must retain the above copyright notice,
  10.    this list of conditions and the following disclaimer.
  11.  
  12.    Redistributions in binary form must reproduce the above copyright notice, 
  13.    this list of conditions and the following disclaimer in the documentation
  14.    and/or other materials provided with the distribution.
  15.  
  16.    All advertising materials mentioning features or use of this software
  17.    must display the following acknowledgement:
  18.  
  19.         This product includes software developed by Ed T. Toton III &
  20.         NecroBones Enterprises.
  21.  
  22.    No modified or derivative copies or software may be distributed in the
  23.    guise of official or original releases/versions of this software. Such
  24.    works must contain acknowledgement that it is modified from the original.
  25.  
  26.    Neither the name of the author nor the name of the business or
  27.    contributers may be used to endorse or promote products derived
  28.    from this software without specific prior written permission.
  29.  
  30. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 
  31. EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
  32. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  33. DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
  34. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  35. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  36. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  37. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  39. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. *)
  41. {$G+}{$N+}{$E+}{$X+}{$D-}
  42. unit egavga;
  43. { This unit links the EGA/VGA BGI graphics driver into a single TPU file.
  44.   This makes it easy to link the driver files directly into an .EXE file. }
  45. interface
  46.  
  47. uses graph;
  48.  
  49.  
  50. procedure egavgaProc;
  51. procedure graph_Abort(Msg : string);
  52. Procedure Graph_VGA;
  53.  
  54. implementation
  55.  
  56.  
  57. procedure egavgaProc; external;
  58. {$L egavga.OBJ }
  59.  
  60. procedure graph_Abort(Msg : string);
  61. begin
  62.   Writeln(Msg, ': ', GraphErrorMsg(GraphResult));
  63.   Halt(1);
  64. end;
  65.  
  66. Procedure Graph_VGA;
  67. var
  68.  driver, mode:integer;
  69.  i:integer;
  70. begin
  71.    if RegisterBGIdriver(@EGAVGAProc) < 0 then
  72.      graph_Abort('EGA/VGA');
  73.  
  74.       driver:=VGA; mode:=VGAHI;
  75.       initgraph(driver,mode,'');
  76.       i:=graphresult;
  77.       if (i<>0) then
  78.        begin
  79.         writeln('Graphics Error: ',GraphErrorMsg(i));
  80.     writeln('You must have a VGA to use 640x480x16 mode');
  81.     halt;
  82.        end;
  83. end;
  84.  
  85. end.
  86.